package com.sjb.training.lc;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: 有点儿意思
 * @Description:
 */
public class TheNumberPlus {
    public static void main(String[] args) {
        int[] arr = {2,7,11,15};
        int[] ints = twoSum(arr, 9);
        for (int i : ints) {
            System.out.println(i);
        }
    }


    public static int[] twoSum(int[] nums, int target) {
        int[] arr = new int[2];
        for (int i = 0; i < nums.length; i++) {
            for (int j = i + 1; j < nums.length; j++) {
                if (nums [i] + nums[j] == target){
                   arr[0] = i;
                   arr[1] = j;
                }
            }
        }
        return arr;
    }
}
